﻿@page "/UPMaster"
@using Microsoft.AspNetCore.Authorization
@using Microsoft.AspNetCore.Components.Authorization
@attribute [Authorize]

<AuthorizeView Policy="UPMaster">
    <Authorized>
        <h3>Hello! @AuthState?.User?.Identity?.Name</h3>
        <br />
        <h3>@AuthState?.User?.FindFirst("UPMaster")?.Value</h3>
    </Authorized>
    <NotAuthorized>
        <h3>☹️</h3>
    </NotAuthorized>
</AuthorizeView>



@code {
    [CascadingParameter]
    private Task<AuthenticationState>? authenticationState { get; set; }

    AuthState? AuthState;

    protected override async Task OnInitializedAsync()
    {
        AuthState = authenticationState?.Result as AuthState;
    }
}